package controlmercancias.gui.actualizaciones;

import controlmercancias.remoto.servidortren.ServidorTrenDemon;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Hasier
 */
public class ActualizacionesServerGUI extends JFrame {

    public ActualizacionesServerGUI() {
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        this.setTitle("Servidor");
        this.setLayout(new BorderLayout());
        JLabel tit = new JLabel("Servidor de actualizaciones");
        tit.setHorizontalAlignment(JLabel.CENTER);
        tit.setFont(new Font(null, Font.BOLD, 20));
        this.add(tit, BorderLayout.NORTH);
        JPanel jp = new JPanel();
        jp.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 10));
        JButton salir = new JButton("Apagar servidor");
        salir.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ActualizacionesServerGUI.this.setEnabled(false);
                ActualizacionesServerGUI.this.dispose();
                ActualizacionesServerGUI.this.processWindowEvent(new WindowEvent(ActualizacionesServerGUI.this, WindowEvent.WINDOW_CLOSING));
                ServidorTrenDemon.exit();
            }
        });
        jp.add(salir);
        this.add(jp, BorderLayout.CENTER);
        this.setSize(400, 100);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
        this.setIconImage(ServidorTrenDemon.appIcon);
    }
}
